<?php

	/**
	 * @see Bike_Js_Container
	 */
	require_once 'Bike/Js/Container.php';
	
	
	class Bike_Js_TryCatch extends Bike_Js_Container
	{
		protected function initDefaultSettings()
		{
			parent::initDefaultSettings();
			
			$js = $this->js();
			$this->setSettings(array(
				'try' => $js->try(),
				'catch' => $js->catch($js->e),
			));
		}

		public function _tryBody($Body)
		{			$this->try->_body($Body);
			return $this;
		}

		public function _catchBody($Body)
		{
			$this->catch->_body($Body);
			return $this;
		}

		public function _catchArgs()
		{
			$args = func_get_args();
			call_user_func_array(array($this->catch, '_args'), $args);
			return $this;
		}
		
		public function __clone()
		{
			parent::__clone();
			$this->initDefaultSettings();
		}
	}
